// js是一门表现力极强的语言

// 对象字面量
const xkl={
    name: '肖凯浪',
    sex:'男',
    hasgirlfriend:true,
    hometown:'宜春',
    room:'研一'
}
xkl.room='1101';
console.log(typeof xkl);

//传统，保守一点
const children=[];
class Person{
    constructor(name,sex){
        this.name=name;
        this.sex=sex;
        if(children.length>=2){
            console.log('感谢你为国家做出贡献');
        }
    }

}

const hail1=new Person('肖大浪');
children.push(hail1);
const hail2=new Person('肖飞');
children.push(hail2);
const hail3=new Person('肖站');
children.push(hail3);
console.log(children);
console.log(typeof children);

{
    var blockI='i'
}
console.log(blockI);

const ele=document.getElementById('user');

/* const nameEle=document.createElement('div');
nameEle.innerText = xkl.name;

const sexEle=document.createElement('div');
sexEle.innerText = xkl.sex;

const hasgirlfriendEle=document.createElement('div');
hasgirlfriendEle.innerText = xkl.hasgirlfriend;

const hometownEle=document.createElement('div');
hometownEle.innerText = xkl.hometown;

const roomEle=document.createElement('div');
roomEle.innerText = xkl.room;

ele.appendChild(
    nameEle
)
ele.appendChild(
    sexEle
)
ele.appendChild(
    hasgirlfriendEle
)
ele.appendChild(
    hometownEle
)
ele.appendChild(
    roomEle
)  */


const txtele=document.createElement('div');
txtele.innerText='name:'+xkl.name+'room:'+xkl.room;
ele.innerHTML=`
<div>姓名${xkl.name}<div>
<div>家乡${xkl.hometown}<div>
<div>房间${xkl.room}<div>
`